import time

from .ReportQueueService import ReportQueueService
from lib.influx import client as influx


class ReportStorageService:
	@staticmethod
	def run():
		while True:
			data = ReportQueueService.pop(ReportQueueService.REPORT_FOR_STORAGE)
			if not data:
				time.sleep(2)
			else:
				influx.write_points()


if __name__ == '__main__':
	ReportStorageService.run()
